package com.qk.management.mapper;

import com.qk.domain.user.UserDO;
import com.qk.dto.user.UserDto;
import com.qk.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/*
 *  @author SHCJ
 *  @created 2025/10/6 12:49
 *  @description
 */
@Mapper
public interface UserMapper {
    List<UserDO> page(UserDto userDto);


    void addUser(UserDO userDO);

    void deleteByIds(List<Integer> ids);

    @Select("select * from user where id = #{id}")
    User selectById(Integer id);

    @Update("update user set username = #{username},password = #{password},name = #{name},phone = #{phone},email = #{email},gender = #{gender},status = #{status},dept_id = #{deptId},role_id = #{roleId},image = #{image},remark = #{remark},update_time = #{updateTime} where id = #{id}")
    void update(User user);

    @Select("select * from user")
    List<User> selectAll();


    List<User> selectByRole(String roleLabel);

    List<User> selectByDept(Integer deptId);


    @Select("select * from user where username= #{username}")
    User selectByUsername(String username);

    @Select("select image from user")
    List<String> getImgUrlAll();
}
